﻿<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE;IE=11;IE=8,chrome=1" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>生产作业平衡</title>
    <link href="/InSiteWebApplication/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/custom-easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/themes/icon.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="/InSiteWebApplication/Content/AnyGantt/css/anychart-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="/InSiteWebApplication/Content/AnyGantt/fonts/css/anychart-font.min.css" />
    <style type="text/css">
        .datagrid-cell{padding:0}
        #ApsTestlayout .panel-header,#ApsPeclayout .panel-header{padding:0}
        #ApsTestlayout .panel-title, #ApsPeclayout .panel-title{height: 24px;line-height: 24px;}
        #ApsTestlayout .datagrid-body:nth-child(1n){margin-top:-1px}
      
        #center .datagrid-header span {font-size: 18px !important;}
        #EQULIST .equ {margin-bottom: 10px;height:80px;width:99%;border: 1px solid #ddd;border-radius: 5px}
        .datagrid-body::-webkit-scrollbar{width:0px;height:8px;}
        .datagrid-body::-webkit-scrollbar-thumb {background:rgba(0,0,0,0.2);border-radius:4px;}
        .fontweight{font-weight:bold}
        .shift{max-width: 200px;display: inline-flex;white-space: nowrap;overflow-x: hidden;}
        .lbtn{border:none;height:24px;width:24px;margin-top:-5px;}
        .dialog-button{text-align: center;}
        .anychart-credits{display:none}
    </style>
</head>
<body>
    <div class="panelSection">    
        <div class="easyui-panel " title="查询区域" style="padding:3px;" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false,fit:true"> 
           <form id="searchForm" method="post">
	    	<table>
                <tr>
                    <td>单元 :</td>
                    <td><input id="poolId" name="poolId" class="easyui-combobox" style="width: 120px; height: 22px" data-options='editable:false'/></td>
                    <td>平衡月份:</td>
                    <td><input id="balanceMonth" name="month" class="easyui-datebox" style="width: 120px; height: 22px" data-options='editable:false,formatter:page.DateboxFormatter'/></td>
                    <td>是否已排:</td>
                    <td><input id="IsAps" name="IsAps" class="easyui-combobox" style="width: 70px; height: 22px" data-options='editable:false'/></td>
                    <td>工序号:</td>
                    <td><input id="Text4" name="workflowStepName" class="easyui-textbox" style="width: 120px; height: 22px" /></td>
                    <td>订单开始日期范围:</td>
                    <td><input id="plans" name="orderBStartDate" class="easyui-datebox" style="width: 120px; height: 22px" data-options='editable:false'/></td>
                    <td>-</td>
                    <td><input id="Text5" name="orderBEndDate" class="easyui-datebox" style="width: 120px; height: 22px" data-options='editable:false'/></td>
                    <td rowspan="2"><a href="javascript:void(0)" class="easyui-linkbutton" style="width:60px" onclick="page.searchData()">查询</a></td>
	    			<td rowspan="2"><a href="javascript:void(0)" class="easyui-linkbutton" style="width:60px" onclick="page.searchReset()">重置</a></td>
                </tr>
	    		<tr>
                    <td>件号：</td>
                    <td><input id="Text13" name="productName" class="easyui-textbox" style="width: 120px; height: 22px" /></td>
                    <td>订单号:</td>
                    <td><input id="Text6" name="mfgorderName" class="easyui-textbox" style="width: 120px; height: 22px" /></td>
                    <td>批次号:</td>
                    <td colspan="3"><input id="containerName" name="containerName" class="easyui-textbox" style="width: 100%; height: 22px" /></td>
                    <td>订单结束日期范围:</td>
                    <td><input id="Text10" name="orderEStartDate" class="easyui-datebox" style="width: 120px; height: 22px" data-options='editable:false'/></td>
                    <td>-</td>
                    <td><input id="Text11" name="orderEEndDate" class="easyui-datebox" style="width: 120px; height: 22px" data-options='editable:false'/></td>
	    		</tr>
	    	</table>
	    </form>
        </div> 
    </div>

    <div class="panelSection">    
        <div class="easyui-panel " title="制造计划批次" style="padding:3px;width:100%" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false"> 
            <div id="ApsTestlayout" class="easyui-layout" style="height:430px;width:100%">
                 <div data-options="region:'center'" id="center" style="width:46%;height:380px;" > 
                    <table id="ApsTest" style="height:380px;width:100%" data-options="rownumbers:true,fit:true,border:false,toolbar: '#tb'"></table>
                  </div>
                  <div data-options="region:'east',title:' '" style="width:54%;" id="east">
                    <div id="ApsTest1" style="height:360px;margin-top:-6px;"></div>
                </div>
                <div data-options="region:'south'" style="height:40px;">
                    <div id="pp" style="float: right" class="easyui-pagination" data-options="   
                         layout:['first','prev','next','last','manual','info'],              
                            total: 0,
                            showPageList: false,
                            showPageInfo: false,
                            showRefresh: false,
                            afterPageText:'共&nbsp{pages}&nbsp页',
                            buttons:[{
                                    iconCls:'',
                                    text:'Go',
                                    group:'paging-tail-btns',
                                    id:'pageGo'
                            }]  
                        ">
                        </div>
                </div>
            </div>
            <div class="easyui-panel" closed="true" id="ApsPec">
                <div style="border-bottom: 1px solid #ddd;">
                            <table>
                                <tr>
                                   <td rowspan="2" style="width:50px"><div class="icon-back" style="height: 48px;cursor: pointer;" onclick="page.returnContainer()"></div></td> 
                                   <td>批次号：</td><td style="min-width:150px"><span id="Span0"></span></td>
                                   <td>当前工序:</td><td style="min-width:150px"><span id="Span1"></span></td>
                                   <td>计划开始:</td><td style="width:150px"><span id="Span2"></span></td>
                                   <td>计划完成:</td><td style="width:150px"><span id="Span3"></span></td>
                                </tr>
                                <tr>
                                    <td colspan="2"><span id="Span4"></span></td>
                                    <td>批次状态:</td><td><span id="Span5"></span></td>
                                    <td>排产开始:</td><td><span id="Span6"></span></td>
                                    <td style="color:rgb(216, 0, 27)">排产完成:</td><td style="color:rgb(216, 0, 27)"><span id="Span7"></span></td>
                                </tr>
                            </table>
                         </div>
                <div style="width:50%;float:left">
                     <table id="ApsSpec" style="height:420px;" data-options="rownumbers:true,border:false,toolbar:'#tb1'"></table>
                </div>
                <div style="width:50%;float:left;">
                     <div style="height:25px;background: white;z-index: 9999;position: relative;border-bottom: 1px solid #ddd;"></div>
                    <div id="ApsSpec1" style="height:394px;margin-top:-5px;border-left:1px solid #ddd"></div>
                </div>
            </div>
        </div>
    </div>
    <div id="tb" style="height:25px">
         <!--  <input class="easyui-combogrid not-custom"  id="Apscolumns" style="width: 25px;height:22px;display:none" data-options="multiple:true"/>-->
	</div>
    <div id="tb1" style="height:25px">
	   <!--<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-reload'" >计划重排</a>
       <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-remove'" >下发派工</a>
       <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" >删除计划</a>
       <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-print'" >流水卡打印</a>-->
	</div>

    <div class="panelSection">    
        <div class="easyui-panel " title=" 设备能力分布" style="padding:3px;" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false,fit:true">
            <div id="Div1" class="easyui-layout" style="height:405px;width:100%" >
                <div data-options="region:'center'" id="Div2" style="width:40%;text-align: center;" > 
                    <div style="padding:10px 0">
                        <span style="margin-right: 10px">设备编号</span><input id="resourCode" class="easyui-textbox" style="width: 20%; height: 25px; " data-options="onChange:page.getApsResourceData"/>
                        <span style="margin-right: 10px">设备名称</span><input id="resourName" class="easyui-textbox" style="width: 20%; height: 25px; " data-options="onChange:page.getApsResourceData"/>
                        <span style="margin-right: 10px">是否无限设备</span><input id="isInfinite" class="easyui-combobox" style="width: 70px;height:25px; " data-options="onChange:page.getApsResourceData,valueField:'id',textField:'text',panelHeight:'auto',value:'0',data:[{id:'',text:'全部'},{id:'1',text:'是'},{id:'0',text:'否'}]"/>
                    </div>
                    <div style="display:inline-block;width:98%;" id="EQULIST">
                    </div>
                </div>
                <div data-options="region:'east',collapsible:false" style="width:54%;" id="Div3">
                    <div style="border:1px solid #ddd;border-radius:5px;height: 30px;line-height: 30px;margin: 10px;padding: 0 10px">
                    设备名称<span id="resourName1" class="fontweight"></span><input type=hidden id="resourceID"/> <input type=hidden id="date"/> 
                    设备编号<span id="resourType1" class="fontweight"></span>  |   班次：<span id="resourShit1" class="fontweight"></span>  |   <span id="resourDay1" class="fontweight"></span>天负荷详情：<span id="resourResult1" class="fontweight"></span></div>
                    <div><a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-reload'" style="float:right;margin-right:13px;" onclick="page.ExportExcle()">导出</a></div>
                     <div><a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-reload'" style="float:right;margin-right:13px;" onclick="page.ExportResDetailExcle()">导出明细</a></div>
                    <div id="initEChar" style="width: 100%;height:330px;float:left;"></div>
                </div>
            </div>
        </div>
     </div>
     <div id="equDialog" style="display:none">
        <table id="equApsTable" style="height:420px;" data-options="rownumbers:true,border:false"></table>
     </div>
     <div id="equDialog1" style="display:none;text-align: center;padding:10px;">
        <div class="panel1 panel12" style="padding:10px 0"><span style="width:150px;display: inline-block;text-align: right;">是否无限能力设备：</span>
            <select class="easyui-combobox" style="width: 120px; height: 22px" id="Isinfinite" data-options='editable:false,panelHeight:"auto"'>
            <option value="0">否</option><option value="1">是</option>
            </select>
        </div>
        <div  class="panel2 panel12" style="padding:10px 0"><span style="width:50px;display: inline-block;text-align: right;">日历：</span>
            <input class="easyui-combobox" id="selMakeCalendar" style="width: 120px; height: 22px" data-options='editable:false,panelHeight:"auto"'/>
        </div>
        <div  class="panel3 panel12" style="padding:10px 0"><span style="width:50px;display: inline-block;text-align: right;">班次：</span>
            <input class="easyui-combobox" id="selWorkShift" style="width: 120px; height: 22px" data-options='editable:false,panelHeight:"auto"'/>
        </div>
        <div  class="panel4 panel12">
              <div style="margin-bottom: 5px;text-align: left;">
                <div id="EmployeeCombox"></div>
                <button id="btnResAddEmp" class="easyui-linkbutton" data-options="" style="margin-left: 5px;" onclick="page.resourceAddEmp()">添 加</button>
                <button id="btnResRemoveEmp" class="easyui-linkbutton" data-options="" onclick="page.resourceRemoveEmp()">移 除</button>
             </div>
            <table id="gdResAndEmp"></table>
        </div>
     </div>

     <!--信息提示区域-->
    <!-- <div id="statusMessage" style="font-size: 14px; height: 40px"></div>-->
</body>
</html>
<script src="/InSiteWebApplication/Scripts/json2.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/array.pollyfill.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/CustomCommon.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/dayjs.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/echarts.min.js" type="text/javascript"></script>


<script src="/InSiteWebApplication/Scripts/CustomPageJs/ReferenceJsLib.js" type="text/javascript"></script>
<script type="text/javascript" src="/InSiteWebApplication/Content/AnyGantt/zh-cn.js"></script>
<script type="text/javascript" src="/InSiteWebApplication/Content/AnyGantt/anychart-base.min.js"></script>
<script type="text/javascript" src="/InSiteWebApplication/Content/AnyGantt/anychart-ui.min.js"></script>
<script type="text/javascript" src="/InSiteWebApplication/Content/AnyGantt/anychart-exports.min.js"></script>
<script type="text/javascript" src="/InSiteWebApplication/Content/AnyGantt/anychart-gantt.min.js"></script>
<script type="text/javascript" src="/InSiteWebApplication/Content/AnyGantt/anychart-data-adapter.min.js"></script>
<script type="text/javascript">
    //创建人：longb
    //日期：2023-08-07
    //描述：生产作业平衡
    var page = {
        pagetotal: 0,
        pageSize: 20,
        pageNumber: 1,
        rootPath: getRootPath(), //网站根路径
        chart:null,
        chart1:null,
        editIndex:null,
        updateCount:0,
        updateRCount:0,//设备关联信息维护
        ajaxUrl: getRootPath() + "/Ashx/ApsHandler/ApsProduceBalanceHandler.ashx",
        comboxUrl: getRootPath() + "/Ashx/ApsHandler/ResourceMaintHandler.ashx", //请求地址
        comboxAction: 'GetEmployee', //请求方法名称
        resourceId:null,
        resourcename:null,
        init: function () {
            page.bind();
            page.InitApsPool();
            customizedEasyuiPagination('pp'); //定制化分页
            //page.initData();
            //page.initEqu(null);
            //page.getApsResourceFHData();
        },
        endEditing:function(id){
             if (page.editIndex == undefined){return true}   
             if ($('#'+id).datagrid('validateRow', page.editIndex)){
				var ed = $('#'+id).datagrid('getEditor', {index:page.editIndex});
				$('#'+id).datagrid('endEdit', page.editIndex);
				page.editIndex = undefined;
				return true;
			} else {
				return false;
			}
        },
        InitApsPool:function(){
            page.post({action:'InitPageData'},false,function(res){
                 $('#poolId').combobox({
                    data:res,
                    valueField:'WORKCENTERID',
                    textField:'WORKCENTERNAME',
                    panelHeight:'auto'
                });
            });
        },
        //页面事件绑定
        bind: function () {
            page.InitDateBoxYearMonth($('#balanceMonth'));
            //是否已排
            $('#IsAps').combobox({
                data:[{id:'',text:'全部'},{id:'1',text:'是'},{id:'0',text:'否'}],
                valueField:'id',
                textField:'text',
                panelHeight:'auto'
            });
            var Apscolumns=[{ field: 'CONTAINERNAME', title: '批次号',width: 150,formatter: function (value, row, index) { 
                    return '<a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.SelectContainer(\'' + index + '\')">' + value + '</a>'; } },
                 { field: 'WORKFLOWINFO', title: '工艺版本', width: 120, align: 'center',formatter: function (value, row, index) {
                    var url="/InSiteWebApplication/forms/Custom/htmlPage/WorkCenterMaintainPage.html?type=1,3,4"+
                    '&pname='+row.PRODUCTNAME+'&pid='+row.PRODUCTID+'&wname='+row.WORKFLOWNAME+'&wid='+row.WORKFLOWID;//encodeURI(
                    return '<a target="_blank" href='+url+' style=""  >'+value+'</a>';
                 }  },
                 { field: 'WORKFLOWSTEPNAME', title: '当前工序', width: 120, align: 'center'  },
                 { field: 'ISPREPARE', title: '生产准备齐套', width: 110, align: 'center'  },
                 { field: 'WORKCENTERNAME', title: '当前工区', width: 100, align: 'center'  },
                 { field: 'STARTTIME', title: '计划开始', width: 100, align: 'center'  },
                 { field: 'ENDTIME', title: '计划完成', width: 100, align: 'center' }];
             //排产左侧表格
            $('#ApsTest').datagrid({
                singleSelect: true,
                frozenColumns: [[{ field:'X', title: '预警',width: 80,hidden:true,align: 'center',rowspan:3}],[],[]],
                columns: [Apscolumns],
                onSelect: function (index, row) {
                    page.getApsResourceData();
                },
                onLoadSuccess: function (data) {
                    $('#pp').pagination('refresh', {	// 改变选项，并刷新分页栏信息
                        total: page.pagetotal,
                        pageSize: page.pageSize,
                        pageNumber: page.pageNumber
                    });
                    customizedEasyuiPagination('pp'); //定制化分页
                    var gantData=[];
                    $.each(data.rows,function(index,item){
                        item.name=item.CONTAINERNAME;
                        item.periods=[{end: dayjs(item.STARTTIME).format('YYYY/MM/DD HH:mm:ss'),id:index,start: dayjs(item.ENDTIME).format('YYYY/MM/DD HH:mm:ss')}];
                        gantData.push(item);
                    })
                    anygantt.loadInfiniteCapacity('ApsTest1',gantData);//甘特图数据加载
                    page.getApsResourceData();//加载设备信息
                }
            });
             //分页事件
            $('#pp').pagination({
                onSelectPage: function (pageNumber, pageSize) {
                    customizedEasyuiPagination('pp'); //定制化分页
                    page.pageSize = pageSize; page.pageNumber = pageNumber;
                    page.getApsProduceBalanceData();
                }
            });
            //绑定分页go按钮
            $('#pageGo').on("click", function () {
                var pageNumber = $(this).parents('tr').find('.pagination-num').val();
                page.pageNumber = pageNumber;
                page.getApsProduceBalanceData();
            });
            //清除按钮
            $('#btnReset').on("click", function () {
                page.reset(true, true);
                page.pageNumber = 1; page.pagetotal = 0
                $('#pp').pagination('refresh', {
                    total: page.pagetotal,
                    pageSize: page.pageSize,
                    pageNumber: page.pageNumber
                });
            });
            //排产明细
           var specColumns = [{ field: 'STATUS', title: '状态', width: 60, align: 'center' },
                 { field: 'SPECNO', title: '工序号', width: 60, align: 'center' },
                 { field: 'SPECNAME', title: '工序名称', width: 140, align: 'left' },
                 { field: 'SPECTYPE', title: '工序类型', width: 80, align: 'center' },
                 { field: 'RESOURCENAME', title: '设备', width: 80, align: 'center' },
                 { field: 'STEPSTARTTIME', title: '计划开始', width: 150, align: 'center' },
                 { field: 'STEPENDTIME', title: '计划完成', width: 150, align: 'center' },
                 { field: 'PLANTIME', title: '持续时间（H）', width: 90, align: 'center', formatter: function (value, row, index) {
                     var diffMin = 0;
                     if(row.STEPENDTIME!=null){
                        diffMin=dayjs(row.STEPENDTIME).diff(dayjs(row.STEPSTARTTIME), 'minute', true);
                        }
                     return Math.floor(diffMin / 60).toString();
                 }},
                 { field: 'PREPARECYCLE', title: '准备时间（min）', width: 100, align: 'center' },
                 { field: 'MAKECYCLE', title: '加工时间（min）', width: 100, align: 'center' },
                 { field: 'TRANSFERCYCLE', title: '转运时间（H）', width: 90, align: 'center' },
                 { field: 'COMMICYCLE', title: '外委周期', width: 70, align: 'center' }
                 ];
           $('#ApsSpec').datagrid({
                singleSelect: true,
                frozenColumns: [[{ field: 'XX', title: '操作', width: 80,hidden:true,rowspan:3}],[],[]],
                columns: [specColumns],
                onSelect: function (index, row) {
                },
                onLoadSuccess: function (data) {
                 var gantData=[];
                    $.each(data.rows,function(index,item){
                        item.name=item.WORKFLOWSTEPNAME;
                        item.periods=[{end: dayjs(item.STEPENDTIME).format('YYYY/MM/DD HH:mm:ss'),id:index,start: dayjs(item.STEPSTARTTIME).format('YYYY/MM/DD HH:mm:ss')}];
                        gantData.push(item);
                    })
                    anygantt.loadInfiniteCapacity('ApsSpec1',gantData);//甘特图数据加载
                }
            });

            $('#equApsTable').datagrid({
                columns:[[
                        { field: 'CONTAINERNAME', title: '批次号', width: 150, align: 'center'},
                        { field: 'WORKFLOWINFO', title: '工艺版本', width: 150, align: 'center'},
                        { field: 'CWFNAME', title: '当前工序', width: 120, align: 'center'},
                        { field: 'WORKFLOWSTEPNAME', title: '排产工序', width: 120, align: 'center'},
                        { field: 'STEPSTARTTIME', title: '工序开始时间', width: 150, align: 'center'},
                        { field: 'STEPENDTIME', title: '工序结束时间', width: 150, align: 'center'},
                        { field: 'RESNAME', title: '设备', width: 120, align: 'center',  
                            editor:{type:'combobox',options:{valueField:'RESOURCEID',textField:'DESCRIPTION',panelHeight:'auto',//method:'get',url:page.ajaxUrl+"?action=GetStepResourceDatas",
                            onSelect:function(r){
                            $('#equApsTable').datagrid('endEdit', page.editIndex);
                             page.editIndex=undefined;
                             page.saveStepResourceData(r);
                        }}}},
                        { field: 'RESSTARTTIME', title: '设备开始时间', width: 150, align: 'center'},
                        { field: 'RESENDTIME', title: '设备结束时间', width: 150, align: 'center'},
                        { field: 'DAYTIME', title: '设备日运行时间（H）', width: 150, align: 'center'},
                        { field: 'WORKCENTERNAME', title: '工区', width: 120, align: 'center'},
                        { field: 'TEAMNAME', title: '班组', width: 100, align: 'center'},
                        { field: 'QTY', title: '数量', width: 50, align: 'center'},
                        { field: 'PREPARECYCLE', title: '准备时间（min）', width: 100, align: 'center' },
                        { field: 'MAKECYCLE', title: '加工时间（min）', width: 100, align: 'center' },
                        { field: 'TRANSFERCYCLE', title: '转运时间（H）', width: 90, align: 'center' },
                        { field: 'COMMICYCLE', title: '外委周期', width: 70, align: 'center' }
                ]],
                onClickRow:function(index,row){
				        if (page.endEditing("equApsTable")){
					        $('#equApsTable').datagrid('selectRow', index).datagrid('beginEdit', index);
					        page.editIndex = index;
                            var ed = $('#equApsTable').datagrid('getEditor', {index:index,field:'RESNAME'});
                            $(ed.target).combobox('loadData',JSON.parse(row.RESORCES));
				        } else {
					        $('#equApsTable').datagrid('selectRow', page.editIndex);
				        }
                },
            })
        
            //设备人员
            $("#gdResAndEmp").datagrid({
                 columns: [[
                    { field: 'ck', title: '选择', checkbox: true },
                    { field: 'EMPLOYEEID', title: '人员id', hidden: true, width: 150 },
                    { field: 'EMPLOYEENAME', title: '人员编号', width: 150 },
                    { field: 'FULLNAME', title: '人员姓名', width: 100 },
                    { field: 'WORKCENTERNAME', title: '工区', width: 120 },
                    { field: 'TEAMNAME', title: '班组', width: 100 }
                  ]]
              });
             $('#EmployeeCombox').selectCombox({
                search: function () { },
                cancel: function () { },
                selected: function (val, text, record) {
                    $('#txtCombox').textbox('setValue', text);
                    $('#divComboxTxt').show();
                    $('#divComboxSelect').hide();
                    $('#divComboxSearch').show();
                    $('#divComboxClear').hide();
                }
            });
        },
        //工序排产隐藏，显示批次排产
        returnContainer: function () {
            $('#ApsTestlayout').show("slow");
            $('#ApsPec').panel("close");
        },

        initEqu:function(data){
            var html1="";
            $.each(data,function(index,item){
            var use=item.TOTALMINS==0?0:item.USETOTALMINS/item.TOTALMINS;
            html1+='<div class="equ" onclick="page.getApsResourceFHData(\''+item.RESOURCEID+'\',this)" data=\''+JSON.stringify(item)+'\'>'+
                            '<div style="width: 100%;display: inline-block;line-height: 30px;" >'+
                                '<div style="text-align:center;width:50px;float:left">'+(index+1)+'</div><div style="float:left">设备名称：<span style="margin-right:20px;font-weight:bold">'+item.RESOURCENAME+'</span>     设备编号：<span style="font-weight:bold">'+item.RESOURCENAMECODE+'</span></div>'+
                            '</div>'+
                            '<div>'+
                                '<div style="height:49px;width:50px;background:'+(use>1?'rgb(216, 0, 27)':'rgb(0, 178, 242)')+';margin-right: 10px;border-bottom-left-radius:5px;padding-top: 14px;float:left;color:white">'+item.USETIME+'%</div>'+
                                '<div style="float:left;line-height: 24px;width: 80%;" >'+
                                    '<div style="display:flow-root;"><div style="text-align: left;width:130px;float:left"><span style="width:80px;display:inline-block">能力：'+item.ISINFINITE+' </span><a href="javascript:void(0)" class=" easyui-linkbutton lbtn " data-options="iconCls:\'icon-edit\'" data=\''+JSON.stringify(item)+'\' onclick="page.editApsResourceData(1,this);"></a></div><div style="float:left">日历：'+item.MAKECALENDARNAME+'<a href="javascript:void(0)" class=" easyui-linkbutton lbtn " data-options="iconCls:\'icon-edit\'" data=\''+JSON.stringify(item)+'\' onclick="page.editApsResourceData(2,this)"></a></div><div style="float:right">排班：否<a href="javascript:void(0)" class=" easyui-linkbutton lbtn " data-options="iconCls:\'icon-edit\'" onclick=""></a></div></div>'+
                                    '<div><div style="text-align: left;width:130px;float:left"><span style="width:80px;display:inline-block">人员：'+item.EMPCOUNT+'</span><a href="javascript:void(0)" class=" easyui-linkbutton lbtn " data-options="iconCls:\'icon-edit\'" data=\''+JSON.stringify(item)+'\' onclick="page.editApsResourceData(4,this)"></a></div><div style="float:left">班次：<span class="shift">'+item.WORKSHIFTNAME+'（'+(Math.floor(item.MINS/60))+'h'+(item.MINS%60)+'min）</span><a href="javascript:void(0)" class=" easyui-linkbutton lbtn " data-options="iconCls:\'icon-edit\'" data=\''+JSON.stringify(item)+'\' onclick="page.editApsResourceData(3,this)"></a></div><div style="float:right">修改排班<a href="javascript:void(0)" class=" easyui-linkbutton lbtn " data-options="iconCls:\'icon-edit\'" onclick=""></a></div></div>'+
                                '</div>'+
                            '</div>'+
                        '</div>'
            });
            $('#EQULIST').html(html1);
            $.parser.parse('#EQULIST');
            if(data.length>0){
                page.getApsResourceFHData(data[0].RESOURCEID,'.equ:first');
                $('.equ:first').css('background','rgba(215, 237, 240, 0.5)');
            }else{
             page.getApsResourceFHData("",null);
                //var data={days:dayjs($('#balanceMonth').datebox('getValue')).daysInMonth() }
                //page.initEChar(null);
            }
        },
        initEChar:function(data){
            var myChart = echarts.init(document.getElementById('initEChar'));
            var xdata=[];
            for(var i=1;i<=data.days;i++){
                xdata.push(i);
            }
            var option = {
                      tooltip: {
                        trigger: 'axis',
                        axisPointer: {
                          type: 'shadow'
                        }
                      },
                      color:['#409EFF','orange','#F56C6C'],
                      legend: {},
                      grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                      },
                      xAxis: [{type: 'category',data:xdata }],
                      yAxis: [{type: 'value'}],
                      series: [
                        {
                          name: '生产',
                          type: 'bar',
                          stack: 'Ad',
                          emphasis: {
                            focus: 'series'
                          },
                          data:data.scdata //[70, 132, 101, 134, 90, 130, 110,100]
                        },
                        {
                          name: '闲置',
                          type: 'bar',
                          stack: 'Ad',
                          emphasis: {
                            focus: 'series'
                          },
                          data: data.xzdata//[20, , , , , 130, 110,0]
                        },
                        {
                          name: '定检',
                          type: 'bar',
                          stack: 'Ad',
                          emphasis: {
                            focus: 'series'
                          },
                          data: data.fhdata//[50, 132, 101, 154, 190, 130, 110,20]
                        },
   
                      ]
                    };
            myChart.setOption(option);
            myChart.on('click', function(params) {
               page.showEquDialog(params.name);
            });
        },
        
        showEquDialog:function(obj){
            $('#date').val($('#balanceMonth').datebox('getValue')+"-"+obj);
           
             $('#equDialog').dialog({
                title:"【"+ $('#date').val()+'】设备排产信息',
                width: 1250,
                height: 480,
                closed: false,
                cache: false,
                modal: true,
                center:true,
                resizable:true,
                onClose:function(){
                    if(page.updateCount>0){page.getApsResourceData();}//关闭弹窗-重新查询设备
                    page.updateCount=0;
                },
                onOpen:function(){
                     page.getStepLimitedAps();
                    $(this).window('center');
                }
            });
            
        },
        //导出
        ExportExcle:function(){
            $.messager.progress({ text: '', msg: '处理中...' });

            var xhr = new XMLHttpRequest();
            //设置响应类型为blob类型
            xhr.responseType = "blob";
            xhr.open("post", page.ajaxUrl, true); //+ "?action=apsLmCalculateExport&containers=" + JSON.stringify(containers)

            /* post 此种传参无效
            xhr.setRequestHeader('Content-Type', 'application/json');
            xhr.send(JSON.stringify(postData));
            */
            // post 这种传参有效
            xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
            xhr.send("action=GetStepLimitedAps&resourceID=" + $('#resourceID').val()+"&date="+$('#balanceMonth').datebox('getValue')+"&type=export");


                                                                                                xhr.onreadystatechange = function () {
            $.messager.progress('close');
            if (xhr.readyState == 4) {
                if (xhr.status == 200) {
                    if (xhr.getResponseHeader("fileDownload") == "1") {
                        var a = window.document.createElement('a');
                        a.href = window.URL.createObjectURL(new Blob([this.response]));
                        a.download = decodeURI(xhr.getResponseHeader("content-disposition").split('filename=')[1]);
                        document.body.appendChild(a)
                        a.click();
                        document.body.removeChild(a)
                    } else {
                        var reader = new FileReader();
                        reader.readAsText(this.response, 'utf-8');
                        reader.onload = function (e) {
                            var result = JSON.parse(reader.result);
                            displayMessage(result.Message, false);
                        }
                    }

                }
            }
        };
            return;


//            page.post({action:'GetStepLimitedAps',resourceID:$('#resourceID').val(),date: $('#balanceMonth').datebox('getValue'),type:'export'},true,function(res){
//                
//            });
        },

        //导出设备明细 add by zhangrj 20231026
        ExportResDetailExcle:function(){
            $.messager.progress({ text: '', msg: '处理中...' });
            var xhr = new XMLHttpRequest();
            //设置响应类型为blob类型
            xhr.responseType = "blob";
            xhr.open("post", page.ajaxUrl, true);
            var dates = {
                  action:"ExportResDetailExcle",
                  resourceName: $('#resourName1').html(),
                  resourceCode: $('#resourType1').html(),
                  resourceID:$('#resourceID').val(),
                  date:$('#balanceMonth').datebox('getValue')
            };
            xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
            xhr.send($.param(dates));
            xhr.onreadystatechange = function () {
                $.messager.progress('close');
                if (xhr.readyState == 4) {
                    if (xhr.status == 200) {
                        if (xhr.getResponseHeader("fileDownload") == "1") {
                            var a = window.document.createElement('a');
                            a.href = window.URL.createObjectURL(new Blob([this.response]));
                            a.download = decodeURI(xhr.getResponseHeader("content-disposition").split('filename=')[1]);
                            document.body.appendChild(a)
                            a.click();
                            document.body.removeChild(a)
                        } else {
                            var reader = new FileReader();
                            reader.readAsText(this.response, 'utf-8');
                            reader.onload = function (e) {
                                var result = JSON.parse(reader.result);
                                displayMessage(result.Message, false);
                            }
                        }

                    }
                }
            };
            return;
        },

        //查询
        searchData: function () {
            page.pageNumber = 1;
            page.getApsProduceBalanceData();
            $('#ApsTest').datagrid('clearSelections');
            //page.getApsResourceData();
            clearMessage();
        },
        getApsProduceBalanceData:function(){
            var frdata = $('#searchForm').serializeArray();
            var data = {};
            $.each(frdata, function () {
                data[this.name] = this.value
            });
            var para={action:'getApsProduceBalanceData',pageNumber:page.pageNumber,pageSize:page.pageSize,data: JSON.stringify(data)}
            page.post(para,true,function(res){
                if(res.Result){
                    page.pagetotal=res.RowCount;
                    $('#ApsTest').datagrid('loadData', res.DBTable);
                }
            });
        },
         //批次排产选择隐藏，显示工序排产
        SelectContainer: function (index) {
            var row=$('#ApsTest').datagrid('getRows')[index];
            $('#Span0').html(row.CONTAINERNAME);
            $('#Span1').html(row.WORKFLOWSTEPNAME);
            $('#Span2').html(row.STARTTIME);
            $('#Span3').html(row.ENDTIME);
            var url="/InSiteWebApplication/forms/Custom/htmlPage/WorkCenterMaintainPage.html?type=1,3,4"+
                    '&pname='+row.PRODUCTNAME+'&pid='+row.PRODUCTID+'&wname='+row.WORKFLOWNAME+'&wid='+row.WORKFLOWID;//encodeURI(
            $('#Span4').html( '<a target="_blank" href='+url+' style="color:rgb(6, 0, 255);"  >'+row.WORKFLOWINFO+'</a>');
            $('#Span5').html(row.ENDTIME);
            page.post({action:'getContainerSpecApsData',ContainerID:row.CONTAINERID,WorkflowID:row.WORKFLOWID},false,function(res){
                $('#ApsSpec').datagrid('loadData', res.DBTable);
                $('#Span6,#Span7').html('');
                if(res.DBTable.length>0){
                    $('#Span6').html(res.DBTable[0].CONSTARTTIME==null?"":dayjs(res.DBTable[0].CONSTARTTIME).format('YYYY-MM-DD'));
                    $('#Span7').html(res.DBTable[0].CONENDTIME==null?"":dayjs(res.DBTable[0].CONENDTIME).format('YYYY-MM-DD'));
                }
                //切换效果
                $('#ApsPec').panel("open");
                $('#ApsTestlayout').hide("slow");
            });
           
        },
        getApsResourceData:function(){
            var row=$('#ApsTest').datagrid('getSelected');
            var para={
                action:'getApsResourceData',
                data:JSON.stringify(row),
                resourName:$('#resourName').textbox('getValue'),
                resourCode:$('#resourCode').textbox('getValue'),
                isInfinite:$('#isInfinite').combobox('getValue'),
                apspoolID:$('#poolId').textbox('getValue'),
                balanceMonth:$('#balanceMonth').datebox('getValue')
                }
             page.post(para,true,function(res){
                page.initEqu(res);
             });
        },
        getApsResourceFHData:function(resourceid,obj)
        {   
            if(obj!=null){
                var resource=JSON.parse($(obj).attr('data'));
                $('#resourName1').html(resource.RESOURCENAME);
                $('#resourType1').html(resource.RESOURCENAMECODE);
                $('#resourShit1').html(resource.WORKSHIFTNAME+"（"+resource.EMPCOUNT+"人）");
                $('#resourDay1').html(dayjs($('#balanceMonth').datebox('getValue')+"-01").daysInMonth() );
                $('#resourResult1').html(resource.USETOTALMINS+"/"+resource.TOTALMINS+"="+resource.USETIME+"%");
            }
            $('.equ').css('background','white');
            $(obj).css('background','rgba(215, 237, 240, 0.5)');
            $('#resourceID').val(resourceid);
            page.post({action:'getApsResourceFHData',resourceid:resourceid,balanceMonth:$('#balanceMonth').datebox('getValue')},false,function(res){
                page.initEChar(res);
             });
        },
        saveStepResourceData:function(data){
            page.post({action:'SaveStepResourceData',data:JSON.stringify(data)},true,function(res){
               if(res.Result){ page.getStepLimitedAps();page.updateCount++;}
                displayMessage(res.Message,true,false);
            });
        },
        getStepLimitedAps:function(){
            page.post({action:'GetStepLimitedAps',resourceID:$('#resourceID').val(),date: $('#date').val(),type:''},true,function(res){
                $('#equApsTable').datagrid('loadData',res);
            });
        },
        editApsResourceData:function(i,obj){
             var resource=JSON.parse($(obj).attr('data'));
             $('.panel12').css('display','none');
             $('.panel'+i).css('display','block');
             page.initPageData(i,resource);
             var buttons=[{
					text:'保存',
					handler:function(){
                        var formData={
                            action:'UpdateResourceData',
                            workShiftId:$('#selWorkShift').combobox('getValue'),
                            makeCalendar:$('#selMakeCalendar').combobox('getValue'),
                            isinfinite:$('#Isinfinite').combobox('getValue'),
                            resourcename:page.resourcename
                        }   
						page.post(formData,true,function(res){
                             displayMessage(res.Message, res.Result);
                             if(res.Result){ page.updateRCount++;}
                        });
					}
				},{
					text:'关闭',
					handler:function(){
						$('#equDialog1').dialog('close')
					}
				}];

             $('#equDialog1').dialog({
                title:'设备关联【'+(i==1?"能力":(i==2?"日历":(i==4?"人员":"班次")))+'】信息维护',
                width: 550,
                height:i==4? 380:150,
                closed: false,
                cache: false,
                modal: true,
                center:true,
                resizable:true,
                onClose:function(){
                    if(page.updateRCount>0){page.getApsResourceData();}//关闭弹窗-重新查询设备
                    page.updateRCount=0;
                },
                buttons: i==4?null:buttons
            });
            $('#equDialog1').window('center');
        },
        initPageData: function (type,obj) {
            page.post({ action: "InitPageData",type:1 }, true, function (res) {
                //绑定日历下拉框
                $("#selMakeCalendar").combobox({
                    valueField: 'MAKECALENDARID',
                    textField: 'MAKECALENDARNAME',
                    panelHeight: 200,
                    data: res.DBDataSet.dtMakeCalendar, //下拉数据
                    value:obj.MAKECALENDARID
                });
                //绑定班次下拉框
                $("#selWorkShift").combobox({
                    valueField: 'WORKSHIFTID',
                    textField: 'WORKSHIFTNAME',
                    panelHeight: 200,
                    data: res.DBDataSet.dtWorkShift, //下拉数据
                    value:obj.WORKSHIFTID
                });
            });
            $('#Isinfinite').combobox('setValue',obj.ISINFINITE=="无限"?1:0);
           page.resourceId=obj.RESOURCEID;
           page.resourcename=obj.RESOURCENAME;
           page.getResAndEmpInfo();
        },
        resourceAddEmp:function(){
              var selectEmp = $('#txtCombox').selectCombox('getValue');
                if (!selectEmp) {
                    displayMessage('请选择要添加的人员', false);
                    return;
                }
            var formData = {
                action: "ResourceAddEmployee",
                resourceid: page.resourceId,
                resourcename: page.resourcename,
                employeeid: selectEmp,
                type:1
            };
            page.post(formData, true, function (res) {
                if (res.Result) {
                    displayMessage('添加成功', res.Result);
                    if(res.Result){ page.updateRCount++;}
                } else {
                    displayMessage(res.Message, res.Result);
                }
                page.getResAndEmpInfo();
            });
        },
        resourceRemoveEmp:function(){
            var ckResourceList = $("#gdResAndEmp").datagrid('getChecked');
                if (ckResourceList.length === 0) {
                    displayMessage('请选择待移除的设备人员', false);
                    return;
                }
               var formData = {
                    action: "ResourceRemoveEmployee",
                    resourceid: page.resourceId,
                    resourcename: page.resourcename,
                    employeeList: JSON.stringify(ckResourceList),
                    type:1
                };
                page.post(formData, true, function (res) {
                    if (res.Result) {
                        displayMessage('移除成功', res.Result);
                        if(res.Result){ page.updateRCount++;}
                    } else {
                        displayMessage(res.Message, res.Result);
                    }
                    page.getResAndEmpInfo();
                });
        },
        getResAndEmpInfo:function(){
            page.post({ action: "GetResAndEmpInfo",type:1,resourceId:page.resourceId,pageSize:100,pageNumber:1 }, true, function (res) {
                 $("#gdResAndEmp").datagrid('loadData', { total: res.RowCount, rows: res.DBTable });
                 $("#gdResAndEmp").datagrid('resize');
            });
        },
        stopDefault:function(e){
            e.stopPropagation();
        },
        //查询重置
        searchReset: function () {
            $('#searchForm').form('clear');
            page.bind();
            clearMessage();
        },
        //清除方法，重要！！！
        reset: function (iscondition, isresult) {
            clearMessage();
        },

        //post数据
        post: function (param, async, callback) {
            $.ajax({
                type: "Post",
                url:param.type==1?page.comboxUrl:page.ajaxUrl,
                data: param,
                cashe: false,
                async: async,
                dataType: "json",
                beforeSend: function () {
                    $.messager.progress({ text: '', msg: '处理中...' });
                },
                success: function (data) {
                    $.messager.progress('close');
                    callback(data);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $.messager.progress('close');
                    displayMessage(XMLHttpRequest.responseText, false);
                }
            });
        },
        //让databox只显示年月
        InitDateBoxYearMonth:function (nyid) {
            nyid.datebox({
                //显示日趋选择对象后再触发弹出月份层的事件，初始化时没有生成月份层
                onShowPanel: function () {
                //触发click事件弹出月份层
                span.trigger('click');
                if (!tds)
                //延时触发获取月份对象，因为上面的事件触发和对象生成有时间间隔
                    setTimeout(function() {
                        tds = p.find('div.calendar-menu-month-inner td');
                        tds.click(function(e) {
                            //禁止冒泡执行easyui给月份绑定的事件
                            e.stopPropagation();
                            //得到年份
                            var year = /\d{4}/.exec(span.html())[0] ,
                                //月份
                                //之前是这样的month = parseInt($(this).attr('abbr'), 10) + 1;
                                month = parseInt($(this).attr('abbr'), 10);

                            //隐藏日期对象
                            nyid.datebox('hidePanel')
                            //设置日期的值
                                .datebox('setValue', year + '-' + month);
                        });
                    }, 0);
            },
            //配置parser，返回选择的日期
            parser: function (s) {
                if (!s) return new Date();
                var arr = s.split('-');
                return new Date(parseInt(arr[0], 10), parseInt(arr[1], 10) - 1, 1);
            },
            //配置formatter，只返回年月 之前是这样的d.getFullYear() + '-' +(d.getMonth());
            formatter: function (d) {
                var currentMonth = (d.getMonth()+1);
                var currentMonthStr = currentMonth < 10 ? ('0' + currentMonth) : (currentMonth + '');
                return d.getFullYear() + '-' + currentMonthStr;
            }
         });

        //日期选择对象
        var p =nyid.datebox('panel'),
            //日期选择对象中月份
            tds = false,
            //显示月份层的触发控件
            span = p.find('span.calendar-text');
        var curr_time = new Date();

        //设置前当月
        nyid.datebox("setValue", page.DateboxFormatter(curr_time));
    },
        DateboxFormatter:function(date) {
            //获取年份
            var y = date.getFullYear();
            //获取月份
            var m = date.getMonth() + 1;
            return y + '-' + m;
        }

    }
    
    var anygantt={
        loadInfiniteCapacity: function (id,Gdata) { //无限产能加载方法
        $('#'+id).empty();///渲染前先清除数据
            anychart.onDocumentReady(function () {

                //anychart.data.loadJsonFile(getRootPath() + "/Ashx/ApsHandler/ZSLimitedCapacityHandler.ashx" + "?action=getStepInfiniteAps&machine=&containerNo=&mfgorderName=ZS&planStartTime=&planEndTime=&status=2", function (result) {

                    anychart.format.outputLocale('zh-cn');
                    anychart.format.inputDateTimeFormat("yyyy/MM/dd HH:mm:ss");

//                    if(result.Result==false){
//                        displayMessage(result.Message, false);
//                        return;
//                    }
                    chart = anychart.ganttResource();
                    chart.dataGrid(false);//隐藏左侧列表
                   
                    if(Gdata==null){return;}
                    var data=Gdata;//JSON.parse(result.ReturnData);
                    //anygantt.returnData=JSON.parse(result.ReturnData);
                    //anygantt.ContainerData=result.DBTable;
                    //console.log(data);

                    var treeData = anychart.data.tree(data, 'as-table');

                    //anygantt.treeData=treeData;
                    // create resource gantt chart
                   
                    chart.defaultRowHeight(31);//设置行高度
                    //chart.headerHeight(105);//设置头部高度
                    chart.splitterPosition(0); //左边grid宽度
                    chart.data(treeData);

                    //设置列
                    var dataGrid = chart.dataGrid();
                    //dataGrid.backgroundFill('blue .4');//
                    //dataGrid.rowFill('red .2');//设置左侧表格行样式 透明度
                     //datagrid tooltips
                    dataGrid.tooltip().useHtml(true); 
                    //chart.getTimeline().baselineFill('#FFAB91')
                    var periods = chart.getTimeline().periods();
                    //chart.getTimeline().rowSelectedFill("#FFAB91");甘特图行选择背景设置
                    // set the height of periods
                    //periods.height(40);//设置甘特图条高度
                    // draw custom periods
                    //periods.rendering().drawer(anygantt.drawingFunction);

                    //图形块的label
                    var periodLabels =periods.labels();
                    periodLabels.enabled(true);
                    periodLabels.useHtml(true);
                    periodLabels.fontColor("#104d89");
                    periodLabels.fontWeight(600);
                    periodLabels.format(function() {
                        let customData=this.period.customData;
                        if(customData!=null){
                            if(customData.isHolidate!=null&&customData.isHolidate=='1'){
                                var text='<span style="color:#fff;font-wieght:bold">'+this.period.text+'</span>';
                                return text;     
                            }
                        }
                    });
                    //console.info(chart.getTimeline())
                    //chart.getTimeline().constructor.("#eeefff")
                    // configure tooltips of the timeline
                chart.getTimeline().tooltip().useHtml(true);
                chart.getTimeline().tooltip().format(function() {
                      var period=this.period;
                      var numChildren = this.item.numChildren();
                      var startDate = anychart.format.dateTime(this.start, "yyyy-MM-dd HH:mm:ss");
                      var endDate = anychart.format.dateTime(this.end, "yyyy-MM-dd HH:mm:ss");
                      var parentText ="<span style='font-weight:600;font-size:12pt'>" + 
                                     '开始:'+startDate + "<br>"+
                                     '结束:'+endDate+"</span>"
                      var childText ="<span style='font-weight:600;font-size:12pt'>" + 
                                     '开始:'+startDate + "<br>"+
                                     '结束:'+endDate+"</span>"
                      if (numChildren > 0) {
                        return parentText;
                      } else {
                        return childText;
                      }

                });

                    //chart.getTimeline().edit(true);//是否开启编辑
                    chart.contextMenu(false);//禁用右键
                    chart.container(id);
                    chart.draw();
                    chart.fitAll();
                    chart.autoRedraw(true);

                    if(id=="ApsTest1"){
                        page.chart=chart;
                    }else{
                        page.chart1=chart;
                    }
                    //滚动到指定位置 add:wangjh
                    
                    //chart.scrollTo(top);
                    //chart.scrollTo(50);
                    //chart.scrollToRow(4);
                    //chart.scrollToEnd(4);                                       
                });
            //});

            //
            
        }
    }
    
    $(function () {
        page.init();

        //甘特图区域滚动事件监听 add:wangjh scroll  mousewheel DOMMouseScroll
        $('#ApsTest1').on("mousewheel DOMMouseScroll", function (event) {
            var delta = (event.originalEvent.wheelDelta && (event.originalEvent.wheelDelta > 0 ? 1 : -1)) ||  // chrome & ie
                        (event.originalEvent.detail && (event.originalEvent.detail > 0 ? -1 : 1));              // firefox
            var deltaData=event.originalEvent.wheelDelta;
            $('#center .datagrid-body').scrollTop($('#center .datagrid-body').scrollTop()-deltaData);
        });
        // easyui datagrid 区域滚动事件监听
       $('#center .datagrid-body:eq(0)').scroll(function () {
           var  chart = anychart.ganttResource();
           page.chart.scrollTo(this.scrollTop);
        })
         //甘特图区域滚动事件监听 add:wangjh scroll  mousewheel DOMMouseScroll
        $('#ApsSpec1').on("mousewheel DOMMouseScroll", function (event) {
            var delta = (event.originalEvent.wheelDelta && (event.originalEvent.wheelDelta > 0 ? 1 : -1)) ||  // chrome & ie
                        (event.originalEvent.detail && (event.originalEvent.detail > 0 ? -1 : 1));              // firefox
            var deltaData=event.originalEvent.wheelDelta;
            $('#ApsPec .datagrid-body').scrollTop($('#ApsPec .datagrid-body').scrollTop()-deltaData);
        });
        // easyui datagrid 区域滚动事件监听
       $('#ApsPec .datagrid-body:eq(0)').scroll(function () {
           var  chart = anychart.ganttResource();
           page.chart.scrollTo(this.scrollTop);
        })
    });
</script>
<script src="/InSiteWebApplication/Scripts/ZsJs/selectCombox.js" type="text/javascript"></script>